package org.example.runafterstart.applicationRunners;

import lombok.extern.slf4j.Slf4j;
import org.example.runafterstart.service.TestServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

/**
 * @Description:
 */
@Component
@Slf4j
public class ApplicationRunnerInitOrder implements ApplicationRunner, Ordered {
    @Autowired
    private TestServiceImpl testService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("ApplicationRunnerInitOrder 在启动后执行..........");
        testService.save();
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
